#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

#define FIFO_NAME "/tmp/fifo-test"

int main() 
{
	FILE * fp = NULL;
	char c;

	mkfifo(FIFO_NAME, 0777);
	
	fp = fopen(FIFO_NAME, "r");

	while (fscanf(fp, "%c", &c)>=0) {
		if (c == '0')
			break;
		printf("%c\n", c);
	}

	fclose(fp);
	unlink(FIFO_NAME);
	return 0;
}

